<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>米行域名批量交易平台-交易所 用户注册</title>
<include file="./Public/public/public.html" />
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/register.css">

</head>
<body>
	<include file="./Public/public/top.html" />
	<div class="layout-wrap register">
		<div class="tab-group mobile-only">
			<a class="active">手机注册</a> <a>邮箱注册</a>
			<div class="clr"></div>
		</div>
		<div class="layout" style="background-color: #fff">
			<div class="swiper-container" style="width: 2342px; height: 483px;">
				<div class="swiper-wrapper" style="width: 2340px; height: 481px;">
					<div class="swiper-slide swiper-slide-visible swiper-slide-active"
						style="width: 1170px; height: 481px;">
						<div class="box">
							<h3>
								<i class="fa fa-mobile-phone fa-lg"></i> 手机注册
							</h3>
							<div>
								<form id="smsRegister" action="{:U('Register/smsregister')}"
									method="post" class="customerPwdLogin">
									<input type="hidden" name="imgCodeId" id="mobRegImgCodeId" value="1" />
									<div class="form-row form-row-s">
										<input class="input-s mobile mt20" placeholder="手机" type="tel"
											maxlength="11" name="mobile"
											valid="{required:true,cellphone:true,maxlength:11}"
											msg="{required:'请输入手机号',cellphone:'输入的手机不正确',maxLength:'不能超过11个字符'}">
									</div>
									<div class="form-row form-row-s mt10">
										<input name="loginpasswd" type="password" class="input-s pwd"
											placeholder="密码" onpaste="return false"
											oncopy="return false;" oncut="return false;" maxlength="20"
											valid="{required:true,minLength:8,maxLength:20}"
											msg="{required:'请填写8-20位密码',minLength:'请填写8-20位密码',maxLength:'请填写8-20位密码,建议数字字母大小写组合'}">
									</div>
									<div class="form-row form-row-s mt10">

										<div class="input-name w50">
											<input id="imgcode6244" name="imgcode" type="text"
												valid="{required:true}" msg="{required:'请填写图形验证码'}" emsg="请填写图形验证码" class="input-s" placeholder="图形验证码">
										</div>

										<div class="input-name w50"
											style="overflow: hidden; height: 28px;">
											<img id="img5709" prop="verifyImg" name="img" src="{:U('Register/regverifyCode','type=1')}" class="code imgCodeCl"
												style="cursor: pointer; margin: -5px 0px -5px 0px">
										</div>
										<div class="clr"></div>
									</div>
									<div class="form-row form-row-s mt10">
										<div class="input-name w50">
										<input id="smscode3727" name="smscode_register" type="tel"
												class="input-s" placeholder="短信验证码">
										</div>
										<div class="input-name w50">
											<div id="5_timer3958" watch="phone" name="register"
												method="sms" emsg=""
												token="d9169f6c5f4bc04212ad2b693c60403a" left="0"
												class="timer w100">发送验证码</div>
										</div>
										<div class="clr"></div>
									</div>
									<div class="form-row form-row-s mt10">

										<div class="input-name w50">
											<input name="pusher" type="text" class="input-s"
												placeholder="邀请码">
										</div>

										<div class="input-name-even w50">没有可不输</div>
										<div class="clr"></div>
									</div>

									<div class="form-row-s mt10">
										<a action="submit" class="button-s button-orange w100">注册</a>
										<div class="clr"></div>
									</div>
								</form>
							</div>
						</div>
					</div>
					<div class="swiper-slide" style="width: 1170px; height: 481px;">
						<div class="box left">

							<h3>
								<i class="fa fa-envelope"></i> 邮箱注册
							</h3>
							<div>
								<form id="emailRegister"
									action="{:U('Register/emailregister')}" method="post"
									class="customerPwdLogin">
                                    <input type="hidden" name="imgCodeId" id="emlRegImgCodeId" value="2" />
									<div class="form-row form-row-s">
										<input class="input-s mt20 email" placeholder="邮箱"
											name="email" maxlength="50"
											valid="{required:true,email:true,maxLength:50}"
											msg="{required:'请填写邮箱地址',email:'输入的邮箱不正确',maxlength:'不能超过50个字符'}">
									</div>
									<div class="form-row form-row-s mt10">
										<input name="loginpasswd" type="password" class="input-s pwd"
											placeholder="密码" onpaste="return false"
											oncopy="return false;" oncut="return false;" maxlength="20"
											valid="{required:true,minLength:8,maxLength:20}"
											msg="{required:'请填写8-20位密码',minLength:'请填写8-20位密码',maxLength:'请填写8-20位密码,建议数字字母大小写组合'}">
									</div>

									<div class="form-row form-row-s mt10">

										<div class="input-name w50">
											<input id="imgcode9586" name="imgcode" type="text"
												valid="{required:true}"
												msg="{required:'请填写图形验证码'}"
												class="input-s" placeholder="图形验证码">
										</div>

										<div class="input-name w50"
											style="overflow: hidden; height: 28px;">
											<img id="img1628" prop="verifyImg" name="img"
												src="{:U('Register/regverifyCode','type=2')}" class="code imgCodeCl"
												style="cursor: pointer; margin: -5px 0px -5px 0px">
										</div>
										<div class="clr"></div>
									</div>
									<div class="form-row form-row-s mt10">
										<div class="input-name w50">
											<input id="smscode3295" name="smscode_register" type="tel"
												valid="{required:true,number:true,limitLength:6}"
												msg="{required:'请填写6位数字邮箱验证码',number:'请填写6位数字邮箱验证码',limitLength:'请填写6位数字邮箱验证码'}"
												class="input-s" placeholder="邮箱验证码">
										</div>
										<div class="input-name w50">
											<div id="21_timer1779" watch="email" name="register"
												method="email" emsg="请输入正确的邮箱地址"
												token="12ad2b693c60403ad9169f6c5f4bc042" left="0"
												class="timer w100">发送验证码</div>
										</div>
										<div class="clr"></div>
									</div>
									<div class="form-row form-row-s mt10">
										<div class="input-name w50">
											<input name="pusher" type="text" class="input-s"
												placeholder="邀请码">
										</div>
										<div class="input-name-even w50">没有可不输</div>
										<div class="clr"></div>
									</div>
									<div class="form-row-s mt10">
										<a action="submit" class="button-s button-blue w100">注册</a>
										<div class="clr"></div>
									</div>

								</form>
							</div>

						</div>
					</div>
				</div>
			</div>
			<div class="clr"></div>
		</div>
	</div>
	<include file="./Public/public/footer.html" />
	<script>
$(document).ready(function(){
	 $('[action=submit]').on('click',function(){
	        $(this).parents('form').Qsubmit();
	    });
//更换验证码
	$(".imgCodeCl").click(function(){
		var codeSrc = $(this).attr("src");
		var rum = getRandom(100);
		var len=codeSrc.lastIndexOf("/");
		if($(this).attr("id")=='img1628') {
			$("#emlRegImgCodeId").val(rum);
		} else {
			$("#mobRegImgCodeId").val(rum);
		}
		codeSrc=codeSrc.substring(0,len)+"/"+rum;
		$(this).attr("src",codeSrc);
	});
	function getRandom(n){
    	return Math.floor(Math.random()*n+1)
    }
	/**
	发送短信验证入口*/
	
	$("#5_timer3958").click(function(){
		smsSend("5_timer3958");
	});
	/**
	发送email验证入口
	*/
	$("#21_timer1779").click(function(){
		emailSend("21_timer1779");
	});
});
/**
 * 倒计时
 */
function fun_timedown(str,time) {
	$("#"+str).text(time+"秒");
    time = time-1;
    if(time>=0){
        setTimeout("fun_timedown('"+str+"','"+time+"')",1000);
    }else{
    	if(str=="21_timer1779") {
    		$("#"+str).bind("click", function(){emailSend(str);});
    	} else {
    		$("#"+str).bind("click", function(){smsSend(str);});
    	}
    	$("#"+str).text("发送验证码");
    }
}
/**
 * 发送短信验证码
 */
var smsSend=function(id){
	var obj=$("#"+id);
	var imgcode = $(obj.parents('form').find('[name=imgcode]')[0]).val();
	var phone = $(obj.parents('form').find('[name=mobile]')[0]).val();
	if(phone==null || phone.length==0) {
		showModal('请输入正确格式的手机号码');
		$(obj.parents('form').find('[name=mobile]')[0]).addClass("input-error");
		return false;
	} else if(phone.length==11) {
		$(obj.parents('form').find('[name=mobile]')[0]).removeClass("input-error");
	} 
	if(imgcode==null || imgcode.length==0) {
		showModal('请填写图形验证码');
		$(obj.parents('form').find('[name=imgcode]')[0]).addClass("input-error");
		return false;
	} else if(imgcode.length==5) {
		$(obj.parents('form').find('[name=imgcode]')[0]).removeClass("input-error");
	}
	var smsurl=$("#smsRegister").attr("action");
	var len=smsurl.lastIndexOf("/");
	smsurl=smsurl.substring(0,len);
	smsurl=smsurl+"/sendRegMobileSms?mobile="+phone+"&regverify="+imgcode+"&imgCodeId="+$("#mobRegImgCodeId").val();
	$.ajax({
		type:'get',
		url:smsurl,
		success:function(data){
			if(data.code=='error') {
				showModal(data.info);
			} else {
				fun_timedown(id,60);
				showModal(data.info);
				$("#"+id).unbind("click");
			}
		}
	});
};
/**
 * 发送email
 */
var emailSend=function(id){
	var obj=$("#"+id);
	var imgcode = $(obj.parents('form').find('[name=imgcode]')[0]).val();
	var email = $(obj.parents('form').find('[name=email]')[0]).val();
	if(email==null || email.length==0) {
		showModal('请输入正确格式邮箱地址');
		$(obj.parents('form').find('[name=email]')[0]).addClass("input-error");
		return false;
	} else if(email.length>0) {
		$(obj.parents('form').find('[name=email]')[0]).removeClass("input-error");
	} 
	if(imgcode==null || imgcode.length==0) {
		showModal('请填写图形验证码');
		$(obj.parents('form').find('[name=imgcode]')[0]).addClass("input-error");
		return false;
	} else if(imgcode.length==5) {
		$(obj.parents('form').find('[name=imgcode]')[0]).removeClass("input-error");
	}
	var smsurl=$("#smsRegister").attr("action");
	var len=smsurl.lastIndexOf("/");
	smsurl=smsurl.substring(0,len);
	smsurl=smsurl+"/sendRegEmail?email="+email+"&regverify="+imgcode+"&imgCodeId="+$("#emlRegImgCodeId").val();
	$.ajax({
		type:'get',
		url:smsurl,
		success:function(data){
			if(data.code=='error') {
				showModal(data.info);
			} else {
				fun_timedown(id,60);
				showModal(data.info);
				$("#"+id).unbind("click");
			}
		}
	});
}
</script>
</body>
</html>